import request from '@/utils/request'

export function fetchShopList(query) {
    return request({
        url: '/admin/rddStore',
        method: 'get',
        params: query
    })
}

export function fetchShopDetail(query) {
    return request({
        url: '/admin/rddStore/' + query.id,
        method: 'get',
    })
}

export function fetchQrCode(id) {
    return request({
        url: '/admin/rddStore/' + id + '/rcCode',
        method: 'get',
    })
}

export function createShop(data) {
    return request({
        url: '/admin/rddStore',
        method: 'post',
        data
    })
}

export function updateShop(data) {
  return request({
    url: '/admin/rddStore/' + data.id,
    method: 'put',
    data: { ...data }
  })
}

export function delShop(data) {
  return request({
    url: '/admin/rddStore/' + data.id,
    method: 'delete'
  })
}

export function fetchArticle(id) {
    return request({
        url: '/article/detail',
        method: 'get',
        params: { id }
    })
}

export function fetchPv(pv) {
    return request({
        url: '/article/pv',
        method: 'get',
        params: { pv }
    })
}

export function updateShopInfo(data) {
  return request({
    url: '/admin/rddStore/0',
    method: 'put',
    data: { ...data }
  })
}

export function getShopUser(data) {
    return request({
        url: '/admin/rddUsers/store/' + data.id,
        method: 'get',
        params: data,
    })
}

export function resetPwd(data) {
    return request({
    url: '/admin/sysUsers/' + data.id + '/resetpassword',
    method: 'put',
    data: { ...data }
  })
}

